const express = require('express');
const path = require('path');
const cors = require('cors');
const app = express();
const port = 8080;

// 启用跨域支持
app.use(cors());

// 托管models目录下的静态资源
app.use('/models', express.static(path.join(__dirname, 'models')));

// 根路由响应
app.get('/', (req, res) => {
    res.send('Express server is running. Visit /models to access static resources.');
});

// 启动服务器
app.listen(port, () => {
    console.log(`Server running at http://localhost:${port}`);
});